package com.hk.photo;


import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.hk.action.Action;
import com.hk.action.ActionForward;
import com.hk.file.FileManager;
import com.jungbo.file.dto.FileDto;

public class PhotoLoadAction implements Action{
	public ActionForward execute(HttpServletRequest request,
			HttpServletResponse response) {
		
		ActionForward forword=new ActionForward();
		FileManager fmanager=new FileManager();
		FileDto fdto = new FileDto();
		int fseq=0;
		
		List<FileDto> fresult = fmanager.getAllFileList();
		
		for(int i=0; i<fresult.size(); i++){
		    FileDto fs =fresult.get(i);
		    
		    if(fseq<fs.getFileseq())
		    	fseq=fs.getFileseq();
			}
		
		
		
		fdto = fmanager.getFname(fseq);
	
		
		String tfname=request.getParameter("name");
//		String fname= tfname.replace("'\'", "'\'");
		
				
//		System.out.println(tfname);
		System.out.println(fdto.getFiledir());
		System.out.println(fdto.getFilename());
		
		request.setAttribute("fname", fdto);
		forword.setUrl("pload");
		forword.setRedirect(false);

	return forword;

	}
}
